package com.buddy.syn.block._11;

public class SynTwoLockService {

    synchronized public static void printA() {
        try {
            System.out.println("线程名称 " + Thread.currentThread().getName()
                    + " 在 " + System.currentTimeMillis() + " 进入printA方法！");
            Thread.sleep(3000);
            System.out.println("线程名称 " + Thread.currentThread().getName()
                    + " 在 " + System.currentTimeMillis() + " 离开printA方法！");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    synchronized public static void printB() {
        System.out.println("线程名称 " + Thread.currentThread().getName()
                + " 在 " + System.currentTimeMillis() + " 进入printB方法！");
        System.out.println("线程名称 " + Thread.currentThread().getName()
                + " 在 " + System.currentTimeMillis() + " 离开printB方法！");
    }

    synchronized public void printC() {
        System.out.println("线程名称 " + Thread.currentThread().getName()
                + " 在 " + System.currentTimeMillis() + " 进入printC方法！");
        System.out.println("线程名称 " + Thread.currentThread().getName()
                + " 在 " + System.currentTimeMillis() + " 离开printC方法！");
    }
}
